/**
 * GoOutReportAction.java
 */
package com.prs.crm.action.oa;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.courser.ui.PaginationSupport;
import org.hibernate.criterion.DetachedCriteria;

import com.prs.crm.action.ReportAction;
import com.prs.crm.domain.oa.BusinessTravel;
import com.prs.crm.domain.oa.GoOut;
import com.prs.crm.domain.oa.LeaveOA;
import com.prs.crm.domain.oa.WorkOverTime;
import com.prs.crm.report.ExportConfig;
import com.prs.crm.report.ReportCell;
import com.prs.crm.report.ReportTable;

/**
 * @author ZhuDongMei
 * @E-mail:1223984339@qq.com
 * @qq:1223984339
 * @version 创建时间：2011-3-16 上午11:12:28 简单说明
 */
/**
 * @author Administrator
 *
 */
public class GoOutReportAction extends ReportAction {
	private PaginationSupport pagination;
	public PaginationSupport getPagination() {
		return pagination;
	}
	public void setPagination(PaginationSupport pagination) {
		this.pagination = pagination;
	}
	@Action(value = "exportGoOut", results = { @Result(name = "success", type = "stream", params = {
			"contentType", "${contentType}", "inputName", "inputStream",
			"bufferSize", "1024", "contentDisposition",
			"filename=${outfileName}" }) })
	public String exportGoOut(){
		ReportTable table = new ReportTable("今日外出人员报表");
		table.addCell(new ReportCell("部门", "recorder.dept.name"));
		table.addCell(new ReportCell("姓名", "recorder.resume.name"));
		table.addCell(new ReportCell("登记时间", "recordTime"));
		table.addCell(new ReportCell("开始时间", "startTime"));
		table.addCell(new ReportCell("结束时间", "endTime"));
		table.addCell(new ReportCell("外出事由", "remark"));
		DetachedCriteria criteria = this.getPaginationHelper().createQuery(
				GoOut.class);
		this.setOutFilePath(this.getReportService().report(criteria, table,
				new ExportConfig(), this.getExportType()));
		return SUCCESS;
	}
	@Action(value = "exportLeaveOAAddReport", results = { 
			@Result(name = "success", type = "stream", params = {
			"contentType", "${contentType}", "inputName", "inputStream",
			"bufferSize", "1024", "contentDisposition",
			"filename=${outfileName}" }) })
	public String exportLeaveOAAddReport(){
		ReportTable table = new ReportTable("请假报表");
		table.addCell(new ReportCell("部门", "recorder.dept.name"));
		table.addCell(new ReportCell("姓名", "recorder.resume.name"));
		table.addCell(new ReportCell("登记", "recordTime"));
		table.addCell(new ReportCell("开始时间", "startTime"));
		table.addCell(new ReportCell("结束时间", "endTime"));
		table.addCell(new ReportCell("请假事由", "remark"));
		DetachedCriteria criteria = this.getPaginationHelper().createQuery(
				LeaveOA.class);
		this.setOutFilePath(this.getReportService().report(criteria, table,
				new ExportConfig(), this.getExportType()));
		return SUCCESS;
	}
	@Action(value = "exportBusinessTravelAddReport", results = { 
			@Result(name = "success", type = "stream", params = {
			"contentType", "${contentType}", "inputName", "inputStream",
			"bufferSize", "1024", "contentDisposition",
			"filename=${outfileName}" }) })
	public String exportBusinessTravelAddReport(){
		ReportTable table = new ReportTable("出差报表");
		table.addCell(new ReportCell("部门", "recorder.dept.name"));
		table.addCell(new ReportCell("姓名", "recorder.resume.name"));
		table.addCell(new ReportCell("登记", "recordTime"));
		table.addCell(new ReportCell("开始时间", "startTime"));
		table.addCell(new ReportCell("结束时间", "endTime"));
		table.addCell(new ReportCell("出差地点", "remark"));
		DetachedCriteria criteria = this.getPaginationHelper().createQuery(
				BusinessTravel.class);
		this.setOutFilePath(this.getReportService().report(criteria, table,
				new ExportConfig(), this.getExportType()));
		return SUCCESS;
	}
	@Action(value = "exportWorkOverTimeAddReport", results = { 
			@Result(name = "success", type = "stream", params = {
			"contentType", "${contentType}", "inputName", "inputStream",
			"bufferSize", "1024", "contentDisposition",
			"filename=${outfileName}" }) })
	public String exportWorkOverTimeAddReport(){
		ReportTable table = new ReportTable("加班报表");
		table.addCell(new ReportCell("部门", "recorder.dept.name"));
		table.addCell(new ReportCell("姓名", "recorder.resume.name"));
		table.addCell(new ReportCell("登记", "recordTime"));
		table.addCell(new ReportCell("开始时间", "startTime"));
		table.addCell(new ReportCell("结束时间", "endTime"));
		table.addCell(new ReportCell("出差地点", "remark"));
		DetachedCriteria criteria = this.getPaginationHelper().createQuery(
				WorkOverTime.class);
		this.setOutFilePath(this.getReportService().report(criteria, table,
				new ExportConfig(), this.getExportType()));
		return SUCCESS;
	}
}
